<?php
/**
 * 学生登陆验证
 * @author gary
 **/
class Services_Auth_Student extends Fend
{

    private $_memcache = '';
    public static function factory()
    {
        return new self();
    }

    public function __construct()
    {
        $this->_memcache = Fend_Cache_Memcache::Factory()->getObj();
    }

    public function checkLogin($cookie='')
    {
        $wx = !empty($cookie)?$cookie:'';
        $wx = !empty($_COOKIE['wx'])?$_COOKIE['wx']:$wx;
        if(empty($wx)){
            return false;
        }
        $string =$this->_memcache->get($wx);
        if(empty($string)){
            return false;
        }
        $arr = explode(';',$string);
        foreach($arr as $v) {
            if(empty($v)){
                continue;
            }
            $key         = explode('|', $v)[0];
            $uinfo[$key] = unserialize(explode('|', $v)[1]. ';');
        }
        Fend_Di::factory()->set('user_info',$uinfo);
        $this->student = $uinfo;
        return $uinfo;
    }


}